<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>统计报告</title>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/bootcdn/BootCDN/ajax/libs/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="<%=path%>/hplus/css/style.min.css"/>
<link rel="stylesheet" type="text/css" href="<%=path%>/hplus/css/font-awesome.min93e3.css"/>
<link rel="stylesheet" type="text/css" href="<%=path%>/hplus/css/plugins/datapicker/bootstrap-datetimepicker.min.css">
<link href="https://cdnjs.cloudflare.com/ajax/libs/awesome-bootstrap-checkbox/0.3.7/awesome-bootstrap-checkbox.min.css" rel="stylesheet">
<script type="text/javascript"  src="<%=path%>/js/system/province-city-area-data.js"></script>
<style type="text/css">
body{font-size: 14px;}
.yellow_circle{
    width: 120px;
    height: 120px;
    background: #fee087;
    border-radius: 50%;
    padding-top: 30px;
    margin: 4px;
}

.yellow_circle p{
    color: #333;
    text-align: center; 
}

.yellow_circle p.people{
    color: #8f721c;
    font-size: 20px;
}

.yellow_circle_border{            
    width:130px;
    height:130px;
    border:1px solid #fee087;
    border-radius: 50%;
    display: inline-block;
}
.k_blue {
	border-color: #c9cff5;
}
.k_blue .yellow_circle {
    background: #c9cff5;
}
a{color:black;padding: 0 8px;}
a:hover{color:#1ab394;}
a.currentNode{color:#1ab394;}
.radio{margin-top: 0;}
.radio-primary input[type="radio"] + label::after {background-color: #1ab394;}
.radio-primary input[type="radio"]:checked + label::after {background-color: #1ab394;}
.radio-primary input[type="radio"]:checked + label::before {border-color: #1ab394;}
</style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content">
	<div class="row">
<!-- 		<div class="col-sm-4"> -->
<!-- 			<div class="input-group"> -->
<!-- 	            <input id="keyword" placeholder="输入名称搜索" type="text" class="form-control"> <span class="input-group-btn">  -->
<!-- 	            <button onclick="func_searchTree()" type="button" class="btn btn-primary">搜索</button> </span> -->
<!-- 	        </div> -->
<!-- 		</div> -->
		<div class="col-sm-4">
			<div class="btn-group">
			    <button class="btn btn-primary" type="button">日</button>
			    <button class="btn btn-white" type="button">周</button>
			    <button class="btn btn-white" type="button">月</button>
			    <button class="btn btn-white" type="button">年</button>
			</div>
		</div>
		<div class="col-sm-4">
		</div>
		<div class="col-sm-3 col-sm-offset-1">
	        <div class="input-daterange input-group">
	            <input type="text" class="input-sm form-control" name="datetimepicker_start" readonly style="background-color: white;">
	            <span class="input-group-addon" style="background-color: #eeeeee;">到</span>
	            <input type="text" class="input-sm form-control" name="datetimepicker_end" readonly style="background-color: white;">
	        </div>
		</div>
	</div>
	
	<div class="row" style="background-color: white;margin-top: 20px;margin-left: 0px;margin-right: 0px;padding: 16px 0;">
		<div class="col-sm-12">
			<h3 style="color: #1ab394;">总览</h3>
		</div>
		<div class="col-sm-3 text-center">
			<div class="yellow_circle_border"><div class="yellow_circle"><p>名片打开量</p><p class="people">0<br/><span>次</span></p></div></div>
		</div>
		<div class="col-sm-3 text-center">
			<div class="yellow_circle_border k_blue"><div class="yellow_circle"><p>名片分享量</p><p class="people">0<br/><span>次</span></p></div></div>
		</div>
		<div class="col-sm-3 text-center">
			<div class="yellow_circle_border"><div class="yellow_circle"><p>点击活动量</p><p class="people">0<br/><span>次</span></p></div></div>
		</div>
		<div class="col-sm-3 text-center">
			<div class="yellow_circle_border k_blue"><div class="yellow_circle"><p>活动转化量</p><p class="people">0<br/><span>次</span></p></div></div>
		</div>
	</div>
	<div class="row" style="background-color: white;margin-top: 20px;margin-left: 0px;margin-right: 0px;padding: 16px 0;">
		<div class="col-sm-12">
			<h3>发展趋势图</h3>
			<div id="line" style="height: 400px;"></div>
		</div>
	</div>
	<div class="row" style="background-color: white;margin-top: 20px;margin-left: 0px;margin-right: 0px;padding: 16px 0;">
		<div class="col-sm-6 listIndex">
			<a class="currentNode" href="javascript:void(0);">员工排行</a>
			<a href="javascript:void(0);">门店排行</a>
			<a href="javascript:void(0);">部门排行</a>
			<a href="javascript:void(0);">活动排行</a>
		</div>
		<div class="col-sm-4">
			<span>显示</span>
			<div class="radio radio-primary" style="display: inline-block;margin-left: 10px;">
		        <input id="a" type="radio" name="showNum" value="10" checked="checked">
		        <label for="a">10</label>
		    </div>
		    <div class="radio radio-primary" style="display: inline-block;margin-left: 10px;">
		        <input id="b" type="radio" name="showNum" value="20">
		        <label for="b">20</label>
		    </div>
		    <div class="radio radio-primary" style="display: inline-block;margin-left: 10px;">
		        <input id="c" type="radio" name="showNum" value="50">
		        <label for="c">50</label>
		    </div>
		    <div class="radio radio-primary" style="display: inline-block;margin-left: 10px;">
		        <input id="d" type="radio" name="showNum" value="100">
		        <label for="d">100</label>
		    </div>
		</div>
		<div class="col-sm-2 text-right">
		<shiro:hasPermission name="statistical_report:show_all">
		<a href="<%=path%>/view/ui/statisticalInfo" style="color:#1ab394;">查看更多</a>
		 </shiro:hasPermission>
		</div>
		<div class="col-sm-12" style="margin-top: 20px;">
			<div id="bar"></div>
		</div>
	</div>
	<div class="row" style="background-color: white;margin-top: 20px;margin-left: 0px;margin-right: 0px;padding: 16px 0;">
		<div class="col-sm-12">
			<h3>地域分布图</h3>
		</div>
		<div class="col-sm-3">
			<div id="pie1" style="height: 400px;"></div>
		</div>
		<div class="col-sm-3">
			<div id="pie2" style="height: 400px;"></div>
		</div>
		<div class="col-sm-3">
			<div id="pie3" style="height: 400px;"></div>
		</div>
		<div class="col-sm-3">
			<div id="pie4" style="height: 400px;"></div>
		</div>
	</div>
</div>
</body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/bootcdn/BootCDN/ajax/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<%=path%>/hplus/js/plugins/datapicker/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="<%=path%>/hplus/js/plugins/datapicker/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/3.7.2/echarts.common.min.js"></script>
<script type="text/javascript">
var path = "<%=path%>";
var startTime = "";
var endTime = "";
var g_top = 10;	//前10列
var listIndex = 0;	//0:员工排行；1:门店排行；2:部门排行；3:活动排行；

$(function(){
	var now = new Date();
	startTime = now.Format("yyyy-MM-dd")+" 00:00:00";
	endTime = now.Format("yyyy-MM-dd")+" 23:59:59";
	$("input[name='datetimepicker_start']").val(startTime.split(" ")[0]);
	$("input[name='datetimepicker_end']").val(endTime.split(" ")[0]);
	
	$("input[name='datetimepicker_start']").datetimepicker({language:"zh-CN",format: 'yyyy-mm-dd',autoclose: true,minView:2})
	.on("click",function(){
        $("input[name='datetimepicker_start']").datetimepicker("setEndDate",$("input[name='datetimepicker_end']").val())
    }).on('changeDate', function(ev){
    	$(".btn-group>button:eq(0)").removeClass("btn-white").addClass("btn-primary").siblings().removeClass("btn-primary").addClass("btn-white");
    	startTime = $("input[name='datetimepicker_start']").val()+" 00:00:00";
    	init();
    });
	$("input[name='datetimepicker_end']").datetimepicker({language:"zh-CN",format: 'yyyy-mm-dd',autoclose: true,minView:2}).on("click",function(){
        $("input[name='datetimepicker_end']").datetimepicker("setStartDate",$("input[name='datetimepicker_start']").val())
    }).on('changeDate', function(ev){
    	$(".btn-group>button:eq(0)").removeClass("btn-white").addClass("btn-primary").siblings().removeClass("btn-primary").addClass("btn-white");
    	endTime = $("input[name='datetimepicker_end']").val()+" 23:59:59";
    	init();
    });
	
	$(".btn-group>button").click(function(){
		var index = $(this).index();
		$(this).removeClass("btn-white").addClass("btn-primary").siblings().removeClass("btn-primary").addClass("btn-white");
		var now = new Date();
		var nowStart = new Date();
		if(index == 0){
			startTime = now.Format("yyyy-MM-dd")+" 00:00:00";
			endTime = now.Format("yyyy-MM-dd")+" 23:59:59";
		}else if(index == 1){
			var week = now.getDay();
			nowStart.setDate(now.getDate() - week + 1);
			startTime = nowStart.Format("yyyy-MM-dd")+" 00:00:00";
			endTime = now.Format("yyyy-MM-dd")+" 23:59:59";
		}else if(index == 2){
			var date = now.getDate();
			nowStart.setDate(1);
			startTime = nowStart.Format("yyyy-MM-dd")+" 00:00:00";
			endTime = now.Format("yyyy-MM-dd")+" 23:59:59";
		}else if(index == 3){
			var date = now.getDate();
			nowStart.setMonth(0);
			nowStart.setDate(1);
			startTime = nowStart.Format("yyyy-MM-dd")+" 00:00:00";
			endTime = now.Format("yyyy-MM-dd")+" 23:59:59";
		}
		$("input[name='datetimepicker_start']").val(startTime.split(" ")[0]);
		$("input[name='datetimepicker_end']").val(endTime.split(" ")[0]);
		
		init();
	});
	
	$(".listIndex>a").click(function(){
		if(listIndex != $(this).index()){
			$(this).addClass("currentNode").siblings().removeClass("currentNode");
			listIndex = $(this).index();
			func_getBar();
		}
	});
	
	$(":radio[name='showNum']").click(function(){
		if(g_top != $(this).val()){
			g_top = $(this).val();
			func_getBar();
		}
	});
	
	init();
});

function init(){
	func_pandect();
	func_getLine();
	func_getBar();
	func_getPie();
}

//总览
function func_pandect(){
	$.post(path+"/social/statistical/pandect",{startTime:startTime,endTime:endTime},function(data){
		if(data.code == "200"){
			$(".people:eq(0)").text(data.data.cardOpenCount);
			$(".people:eq(1)").text(data.data.cardShareCount);
			$(".people:eq(2)").text(data.data.activityOpenCount);
			$(".people:eq(3)").text(data.data.activityCommitCount);
		}
	},"json");
}

//折线图
function func_getLine(){
	$.post(path+"/social/statistical/getLine",{startTime:startTime,endTime:endTime},function(data){
		if(data.code == "200"){
			var activityCommitCountByDay = [];
			var x_data = [];
			var y_data = {};
			$.each(data.data.activityCommitCount,function(i,d){
				x_data.push(d.day);
				activityCommitCountByDay.push(d.count);
			});
			
			y_data.activityCommitCount = activityCommitCountByDay;
			y_data.activityOpenCount = func_convertArr(data.data.activityOpenCount);
			y_data.cardOpenCount = func_convertArr(data.data.cardOpenCount);
			y_data.cardShareCount = func_convertArr(data.data.cardShareCount);
			func_line(x_data,y_data);
		}
	},"json");
}

//柱状图
function func_getBar(){
	$.post(path+"/social/statistical/getBar",{startTime:startTime,endTime:endTime,listIndex:listIndex,top:g_top},function(data){
		if(data.code == "200"){
			var x_data = [];
			var y_data = {};
			var cardOpenCount = [];
			var cardShareCount = [];
			var activityOpenCount = [];
			var activityCommitCount = [];
			var heightBase = 0;	//高的基数
			if(listIndex == 0){	//员工排行
				$.each(data.data,function(i,d){
					heightBase = i+1;
					var username = "无名";
					if(d.username != undefined){
						username = d.username;
					}
					x_data.push(username);
					cardOpenCount.push(d.cardOpenCount);
					cardShareCount.push(d.cardShareCount);
					activityOpenCount.push(d.activityOpenCount);
					activityCommitCount.push(d.activityCommitCount);
				});
				y_data.cardOpenCount = cardOpenCount;
				y_data.cardShareCount = cardShareCount;
				y_data.activityOpenCount = activityOpenCount;
				y_data.activityCommitCount = activityCommitCount;
				
// 				x_data = data.data.userName;
				
// 				y_data.activityCommitCount = func_convertArr(data.data.activityCommitCount);
// 				y_data.activityOpenCount = func_convertArr(data.data.activityOpenCount);
// 				y_data.cardOpenCount = func_convertArr(data.data.cardOpenCount);
// 				y_data.cardShareCount = func_convertArr(data.data.cardShareCount);
			}else if(listIndex == 1){	//门店排行
				$.each(data.data,function(i,d){
					heightBase = i+1;
					x_data.push(d.storeName);
					cardOpenCount.push(d.cardOpenCount);
					cardShareCount.push(d.cardShareCount);
					activityOpenCount.push(d.activityOpenCount);
					activityCommitCount.push(d.activityCommitCount);
				});
				y_data.cardOpenCount = cardOpenCount;
				y_data.cardShareCount = cardShareCount;
				y_data.activityOpenCount = activityOpenCount;
				y_data.activityCommitCount = activityCommitCount;
				
// 				$.each(data.data.cardOpenCount,function(i,d){
// 					x_data.push(d.storeName);
// 				});
				
// 				y_data.activityCommitCount = func_convertArr(data.data.activityCommitCount);
// 				y_data.activityOpenCount = func_convertArr(data.data.activityOpenCount);
// 				y_data.cardOpenCount = func_convertArr(data.data.cardOpenCount);
// 				y_data.cardShareCount = func_convertArr(data.data.cardShareCount);
			}else if(listIndex == 2){	//部门排行
				$.each(data.data,function(i,d){
					heightBase = i+1;
					x_data.push(d.deptName);
					cardOpenCount.push(d.cardOpenCount);
					cardShareCount.push(d.cardShareCount);
					activityOpenCount.push(d.activityOpenCount);
					activityCommitCount.push(d.activityCommitCount);
				});
				y_data.cardOpenCount = cardOpenCount;
				y_data.cardShareCount = cardShareCount;
				y_data.activityOpenCount = activityOpenCount;
				y_data.activityCommitCount = activityCommitCount;
				
				
// 				$.each(data.data.cardOpenCount,function(i,d){
// 					x_data.push(d.deptName);
// 				});
				
// 				y_data.activityCommitCount = func_convertArr(data.data.activityCommitCount);
// 				y_data.activityOpenCount = func_convertArr(data.data.activityOpenCount);
// 				y_data.cardOpenCount = func_convertArr(data.data.cardOpenCount);
// 				y_data.cardShareCount = func_convertArr(data.data.cardShareCount);
			}else if(listIndex == 3){	//活动排行
				$.each(data.data,function(i,d){
					heightBase = i+1;
					x_data.push(d.activityName);
					activityOpenCount.push(d.activityOpenCount);
					activityCommitCount.push(d.activityCommitCount);
				});
				y_data.activityOpenCount = activityOpenCount;
				y_data.activityCommitCount = activityCommitCount;
			}
			
			$("#bar").height((heightBase+2)*60);
			if(listIndex==0 || listIndex==1 || listIndex==2){
				func_bar(x_data,y_data);
			}else if(listIndex==3){
				func_bar2(x_data,y_data);
			}
		}
	},"json");
}

//饼图
function func_getPie(){
	$.post(path+"/social/statistical/getPie",{startTime:startTime,endTime:endTime,top:10},function(data){
		if(data.code == "200"){
			var data1 = [];
			var data2 = [];
			var top10Count = 0;
			var totalCount = data.data.cardOpenCountTotal;
			
			$.each(data.data.cardOpenCountGroup,function(i,d){
				var city = getNameByCode(d.city_id);
				var count = d.count;
				if(city == undefined){
					city = "其他";
				}
				var temp = {};
				top10Count += Number(count);
				temp.name = city,
				temp.value = count;
				data1.push(city);
				data2.push(temp);
			});
			
			if(totalCount > top10Count){
				var city = "其他";
				data1.push(city);
				var temp = {};
				temp.name = city,
				temp.value = totalCount - top10Count;
				data1.push(city);
				data2.push(temp);
			}
			
			if(data2.length == 0){
				var temp = {};
				temp.name="暂无";
				temp.value=1;
				temp.itemStyle = {normal:{color:"#ddd"}};
				data2.push(temp);
			}
			func_pie("名片打开","pie1",data1,data2);
			/*======================================================================================*/
			data1 = [];
			data2 = [];
			top10Count = 0;
			totalCount = data.data.cardShareCountTotal;
			
			$.each(data.data.cardShareCountGroup,function(i,d){
				
				var city = getNameByCode(d.city_id);
				var count = d.count;
				if(city == undefined){
					city = "其他";
				}
				var temp = {};
				top10Count += Number(count);
				temp.name = city,
				temp.value = count;
				data1.push(city);
				data2.push(temp);
			});
			
			if(totalCount > top10Count){
				var city = "其他";
				data1.push(city);
				var temp = {};
				temp.name = city,
				temp.value = totalCount - top10Count;
				data1.push(city);
				data2.push(temp);
			}
			
			if(data2.length == 0){
				var temp = {};
				temp.name="暂无";
				temp.value=1;
				temp.itemStyle = {normal:{color:"#ddd"}};
				data2.push(temp);
			}
			func_pie("名片分享","pie2",data1,data2);
			/*======================================================================================*/
			data1 = [];
			data2 = [];
			top10Count = 0;
			totalCount = data.data.activityOpenCountTotal;
			
			$.each(data.data.activityOpenCountGroup,function(i,d){
				var city = getNameByCode(d.city_id);
				var count = d.count;
				if(city == undefined){
					city = "其他";
				}
				var temp = {};
				top10Count += Number(count);
				temp.name = city,
				temp.value = count;
				data1.push(city);
				data2.push(temp);
			});
			
			if(totalCount > top10Count){
				var city = "其他";
				data1.push(city);
				var temp = {};
				temp.name = city,
				temp.value = totalCount - top10Count;
				data1.push(city);
				data2.push(temp);
			}
			
			if(data2.length == 0){
				var temp = {};
				temp.name="暂无";
				temp.value=1;
				temp.itemStyle = {normal:{color:"#ddd"}};
				data2.push(temp);
			}
			func_pie("活动点击","pie3",data1,data2);
			/*======================================================================================*/
			data1 = [];
			data2 = [];
			top10Count = 0;
			totalCount = data.data.activityCommitCountTotal;
			
			$.each(data.data.activityCommitCountGroup,function(i,d){
				var city = getNameByCode(d.city_id);
				var count = d.count;
				if(city == undefined){
					city = "其他";
				}
				var temp = {};
				top10Count += Number(count);
				temp.name = city,
				temp.value = count;
				data1.push(city);
				data2.push(temp);
			});
			
			if(totalCount > top10Count){
				var city = "其他";
				data1.push(city);
				var temp = {};
				temp.name = city,
				temp.value = totalCount - top10Count;
				data1.push(city);
				data2.push(temp);
			}
			
			if(data2.length == 0){
				var temp = {};
				temp.name="暂无";
				temp.value=1;
				temp.itemStyle = {normal:{color:"#ddd"}};
				data2.push(temp);
			}
			func_pie("活动转化","pie4",data1,data2);
		}
	},"json");
}

function func_convertArr(data){
	var result = [];
	$.each(data,function(i,d){
		result.push(d.count);
	});
	return result;
}

function func_line(x_data,y_data){
    var myChart = echarts.init(document.getElementById('line'));

    var option = {
//         title: {
//             text: 'ECharts 入门示例'
//         },
        tooltip: {},
        legend: {
//             left:"left",
            data:['活动转化量','活动点击量','名片打开量','名片分享量']
        },
        xAxis: {
        	axisLine: {show: false},
	    	axisTick:{show:false},
            data: x_data
        },
        yAxis: {
	        axisLine: {show: false},
	    	axisTick:{show:false}
        },
        series: [{
            name: '活动转化量',
            type: 'line',
            data: y_data.activityCommitCount
        },{
            name: '活动点击量',
            type: 'line',
            data: y_data.activityOpenCount
        },{
            name: '名片打开量',
            type: 'line',
            data: y_data.cardOpenCount
        },{
            name: '名片分享量',
            type: 'line',
            data: y_data.cardShareCount
        }]
    };
    
	myChart.setOption(option);
}

function func_bar(x_data,y_data){
	var temp = echarts.getInstanceByDom(document.getElementById('bar'));
	if(temp != null){
		temp.dispose();
	}
    var myChart = echarts.init(document.getElementById('bar'));

    var option = {
//         title: {
//             text: 'ECharts 入门示例'
//         },
        tooltip: {},
        legend: {
//             left:"left",
            data:['名片打开量','名片分享量','活动点击量','活动转化量']
        },
        xAxis: {
        	show:false
        },
        yAxis: {
        	data: x_data,
        	axisLine: {show: false},
        	axisTick:{show:false},
        	inverse:true
        },
        series: [{
            name: '名片打开量',
            type: 'bar',
            barGap:0,
            data: y_data.cardOpenCount
        },{
            name: '名片分享量',
            type: 'bar',
            data: y_data.cardShareCount
        },{
            name: '活动点击量',
            type: 'bar',
            data: y_data.activityOpenCount
        },{
            name: '活动转化量',
            type: 'bar',
            data: y_data.activityCommitCount
        }]
    };
    
	myChart.setOption(option);
	myChart.resize();
}

function func_bar2(x_data,y_data){
	var temp = echarts.getInstanceByDom(document.getElementById('bar'));
	if(temp != null){
		temp.dispose();
	}
    var myChart = echarts.init(document.getElementById('bar'));

    var option = {
        tooltip: {},
        legend: {
            data:['点击量','转化量']
        },
        xAxis: {
        	show:false
        },
        yAxis: {
        	data: x_data,
        	axisLine: {show: false},
        	axisTick:{show:false},
        	inverse:true
        },
        series: [{
            name: '点击量',
            type: 'bar',
            barGap:0,
            data: y_data.activityOpenCount
        },{
            name: '转化量',
            type: 'bar',
            data: y_data.activityCommitCount
        }]
    };
    
	myChart.setOption(option);
	myChart.resize();
}

function func_pie(name,nodeId,data1,data2){
    var myChart = echarts.init(document.getElementById(nodeId));

    var option = {
        tooltip : {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
  		title : {
  	        text: name,
  	        x:'center',
			y:"bottom"
  	    },
        legend: {
            data: data1
        },
        series: [{
            name: '百分比',
            type: 'pie',
            data: data2
        }]
    };
    
	myChart.setOption(option);
}

Date.prototype.Format = function (fmt) { //author: meizz 
    var o = {
        "M+": this.getMonth() + 1, //月份 
        "d+": this.getDate(), //日 
        "h+": this.getHours(), //小时 
        "m+": this.getMinutes(), //分 
        "s+": this.getSeconds(), //秒 
        "q+": Math.floor((this.getMonth() + 3) / 3),
        "S": this.getMilliseconds() //毫秒 
    };
    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
    if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
}
</script>
</html>